package com.hg.library.http;

import java.io.IOException;

import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.Response;

/**
 * Created by ASUS-PC on 2016/6/14.
 */
public abstract class RequestHandle implements Callback {
    @Override
    public void onFailure(Call call, IOException e) {
        onFailure(e.getMessage(),call,e);
    }

    @Override
    public void onResponse(Call call, Response response) throws IOException {
        onSuccess(call,response);
    }

    protected abstract void onSuccess(Call call, Response response);

    protected abstract void onFailure(String error, Call call, IOException e);
}
